var e = require("../../../../@babel/runtime/helpers/typeof"), t = getApp();

Page({
    data: {
        language: "",
        member: {},
        rewardsList: [],
        rewardsData: {},
        setLang: {},
        teamData: [],
        team_cost_count: {}
    },
    onLoad: function(e) {
        this.checkrouter(), this.getData();
    },
    checkrouter: function() {
        try {
            var t = function() {
                for (var e = wx.getStorageSync("yz_basic_info"), t = e.popularize_page.mini.vue_route, a = 0; a < t.length; a++) if ("MRYT" == t[a]) return console.log(e.popularize_page.mini.mini_url + "跳转的路径"), 
                wx.showToast({
                    title: "未开启推广权限",
                    duration: 1e3,
                    icon: "none",
                    success: function() {
                        setTimeout(function() {
                            wx.redirectTo({
                                url: e.popularize_page.mini.mini_url
                            });
                        }, 1e3);
                    }
                }), {
                    v: void 0
                };
            }();
            if ("object" === e(t)) return t.v;
        } catch (e) {
            console.log(e);
        }
    },
    onReady: function() {
        var e = wx.getStorageSync("langIndex");
        this.setData({
            language: e.en
        });
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    toReward: function(e) {
        var t = e.currentTarget.dataset.item || e.target.dataset.item;
        wx.navigateTo({
            url: "/packageB/member/enterprise/AwardRecord/AwardRecord?name=" + t.identifying + "&reward_name=" + t.reward_name + "&fromHome=1"
        });
    },
    getData: function() {
        var e = this, a = t.getNetAddresss("plugin.mryt.api.home.index");
        t._getNetWork({
            url: a,
            success: function(t) {
                var a = t.data;
                1 === a.result ? (e.setData({
                    rewardsData: a.data,
                    member: a.data.member,
                    rewardsList: a.data.rewards,
                    setLang: a.data.set,
                    WXtitle: a.data.set.name,
                    teamData: a.data.team_statistics,
                    team_cost_count: a.data.team_cost_count
                }), wx.setNavigationBarTitle({
                    title: a.data.set.name ? a.data.set.name : ""
                })) : wx.showToast({
                    title: a.msg,
                    icon: "none"
                });
            },
            fail: function(e) {
                console.log(e);
            }
        });
    },
    gotoTeamDataCount: function(e) {
        "VIP" == e && wx.navigateTo({
            url: "/packageB/member/enterprise/TeamDataCount/TeamDataCount?is_type=vip"
        });
        var t = e.currentTarget.dataset.item || e.target.dataset.item;
        wx.navigateTo({
            url: "/packageB/member/enterprise/TeamDataCount/TeamDataCount?type=" + t.type + "&level=" + t.level
        });
    }
});